home *** CD-ROM | disk | FTP | other *** search
- /**************************************************************************
- * APLXINIT.C - aplx_init(), apl_xexit() functions; new global data items.
- *************************************************************************/
-
- #include "gemfintl.h"
-
- #undef appl_init /* undo the remapping macros that gemfintl.h sets up to */
- #undef appl_exit /* get applications into here; we need The Real Thing. */
-
- void (*_AesVCleanup) __PROTO((void)) = NULL; /* var shared with APLVWORK.C */
-
- /*-------------------------------------------------------------------------
- * new global data items (for use in gemfast utils and by application)...
- *-----------------------------------------------------------------------*/
-
- unsigned short gl_grfhandle=0; /* global physical VDI handle */
-
- unsigned short gl_wchar; /* width of a character */
- unsigned short gl_w2char; /* width of a character / 2 */
- unsigned short gl_w4char; /* width of a character / 4 */
- unsigned short gl_w8char; /* width of a character / 8 */
-
- unsigned short gl_hchar; /* height of a character */
- unsigned short gl_h2char; /* height of a character / 2 */
- unsigned short gl_h4char; /* height of a character / 4 */
- unsigned short gl_h8char; /* height of a character / 8 */
-
- unsigned short gl_wbox; /* width of a boxchar */
- unsigned short gl_w2box; /* width of a boxchar / 2 */
- unsigned short gl_w4box; /* width of a boxchar / 4 */
- unsigned short gl_w8box; /* width of a boxchar / 8 */
-
- unsigned short gl_hbox; /* height of a boxchar */
- unsigned short gl_h2box; /* height of a boxchar / 2 */
- unsigned short gl_h4box; /* height of a boxchar / 4 */
- unsigned short gl_h8box; /* height of a boxchar / 8 */
-
- GRECT gl_rwdesk; /* coordinates of work area of the desktop */
- GRECT gl_rfscrn; /* coordinates of the full screen */
-
- /*-------------------------------------------------------------------------
- * apl_cleanup() - Clean up transient resources we've aquired.
- *
- * For now, that means close the shared VDI workstation. We do this
- * by calling through the vdi cleanup vector if it is non-NULL. if
- * the shared workstation was ever opened, the vector is set by the
- * apl_vopen() routine to point to the closer routine. Since the
- * actual vector variable lives in this module, and starts out as NULL,
- * we avoid making a direct call to the vdi cleanup, and thus we avoid
- * linking all the vdi groodah into a program that doesn't need it.
- *
- * Right now, we don't use the options value. Someday we are going to
- * have transient and permenant resources, and the flag will indicate
- * whether the permenant resources are also to be cleaned up.
- *-----------------------------------------------------------------------*/
-
- void apl_cleanup(options)
- short options;
- {
- (void)options;
- if (_AesVCleanup != NULL) {
- (*_AesVCleanup)();
- }
- }
-
- /*-------------------------------------------------------------------------
- * _ApXinit() - internal routine to init new global data items.
- *
- * this is called from apl_xinit(), below, and also from apl_vopen().
- * the latter is a just-in-case call, on the off chance that the caller
- * never came through the extended init in the first place.
- *-----------------------------------------------------------------------*/
-
- void _ApXinit()
- {
- gl_grfhandle = graf_handle(&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox);
-
- gl_w2char = gl_wchar / 2; /* the library routines do a lot of */
- gl_w4char = gl_wchar / 4; /* rez-independant things based on halves, */
- gl_w8char = gl_wchar / 8; /* quarters, and eighths of a char. */
-
- gl_h2char = gl_hchar / 2;
- gl_h4char = gl_hchar / 4;
- gl_h8char = gl_hchar / 8;
-
- gl_w2box = gl_wbox / 2;
- gl_w4box = gl_wbox / 4;
- gl_w8box = gl_wbox / 8;
-
- gl_h2box = gl_hbox / 2;
- gl_h4box = gl_hbox / 4;
- gl_h8box = gl_hbox / 8;
-
- winx_get(0, WF_WORKXYWH, &gl_rwdesk);
- gl_rfscrn.g_x = gl_rfscrn.g_y = 0;
- gl_rfscrn.g_w = gl_rwdesk.g_x + gl_rwdesk.g_w;
- gl_rfscrn.g_h = gl_rwdesk.g_y + gl_rwdesk.g_h;
- }
-
- /*-------------------------------------------------------------------------
- * apl_xinit() - Extended init. Does appl_init() plus fills in new global
- * data items. A GEMFAST.H macro makes this routine get
- * invoked when the application calls appl_init().
- *-----------------------------------------------------------------------*/
-
- short apl_xinit()
- {
- if (0 <= appl_init()) {
- _ApXinit();
- }
- return gl_apid;
- }
-
- /*-------------------------------------------------------------------------
- * apl_xexit() - extended exit. call the cleanup routine, then appl_exit().
- *-----------------------------------------------------------------------*/
-
- void apl_xexit()
- {
- apl_cleanup(APL_RTRANSIENT|APL_RPERMANENT);
- appl_exit();
- }
-
-
-